package com.android.jogomemoria;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;

public class DefaultAdapter extends BaseAdapter {
	 
	private Integer defaultImageId=R.drawable.icon_costas;
	private Context mContext;
	private int numberImages=0;
	public DefaultAdapter(Context c,int numberImages,Integer defaultImageId){
		this.mContext=c;
		this.numberImages=numberImages;
		this.defaultImageId=defaultImageId;
	}
	public DefaultAdapter(Context c,int numberImages){
		this.mContext=c;
		this.numberImages=numberImages;
	}

	public int getCount() {
		return this.numberImages;
	}

	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		ImageView imageView;
        if (convertView == null) {  // if it's not recycled, initialize some attributes
            imageView = new ImageView(mContext);
            imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
            imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
            imageView.setPadding(8, 8, 8, 8);
        } else {
            imageView = (ImageView) convertView;
        }

        imageView.setImageResource(this.defaultImageId);
        return imageView;
	}
	public Integer getDefaultImageId() {
		return defaultImageId;
	}
}
